# -*- coding: utf-8 -*- 
# @project : 《Atcoder》
# @Author : created by bensonrachel on 2021/6/22
# @File : C - ABC Tournament.py

import math
import copy

N = int(input())
rate = [int(i) for i in input().split()]
rate.insert(0, 0)
char = copy.deepcopy(rate)
for i in range(1, N + 1):
    if (i == N):
        a = min(char[1], char[2])
        print(rate.index(a))
    else:
        for j in range(1, int(math.pow(2, N - i)) + 1):
            char[j] = max(char[2 * j - 1], char[2 * j])
"""
模拟法
https://atcoder.jp/contests/abc188/tasks/abc188_c
"""

N = int(input())
rate = [int(i) for i in input().split()]
if(N==1):
    a = min(rate)
    print(rate.index(a)+1)
else:
    a = min(max(rate[0:int(len(rate)/2)]),max(rate[int(len(rate)/2)+1:]))
    print(rate.index(a)+1)
"""
观察技巧法
"""
